<template>
	<section>
		<!--工具条-->
		<el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
			<el-form :inline="true" :model="query">
				<el-form-item>
					<el-input v-model="query.keyword" placeholder="关键字"></el-input>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" v-on:click="search">查询</el-button>
				</el-form-item>
			</el-form>
		</el-col>

		<!--列表:优秀实践，copy domain修改列表-->
		<el-table :data="pageData.rows" highlight-current-row v-loading="listLoading" style="width: 100%;">
			<el-table-column type="index" width="60">
			</el-table-column>
			<el-table-column prop="pet.name" label="宠物名称" width="240" sortable>
			</el-table-column>
      <el-table-column prop="state" label="是否通过" width="140" sortable>
        <template scope="scope">
          <span v-if="scope.row.state==0" style="color: red">未通过</span>
          <span v-if="scope.row.state!=0" style="color: green">通过</span>
        </template>
      </el-table-column>
      <el-table-column prop="note" label="详情" width="380" sortable>
      </el-table-column>
			<el-table-column prop="auditId" label="审核人员" width="180" sortable>
        <template scope="scope">
          <span v-if="scope.row.auditId == null" style="color: red">AI审核</span>
          <span v-if="scope.row.auditId != null" style="color: green">管理员</span>
        </template>
			</el-table-column>
      <el-table-column prop="auditTime" label="审核时间" sortable>
			</el-table-column>
		</el-table>

		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :current-page="query.currentPage" :page-size="query.pageSize" :total="pageData.total" style="float:right;">
			</el-pagination>
		</el-col>

	</section>
</template>

<script>
	export default {
		data() {
			return {
			    title:'',
				pageData:{
				    total:0,//分页条
					rows:[]//数据表格
				},
				query:{
				    keyword:'',
				    currentPage:1,//分页条
					pageSize:10 //分页条
				},
				listLoading: false,
			}
		},
		methods: {
			search(){
			    //修改页码
			    this.query.currentPage =1;
			    //改查询条件=双向绑定输入时自动改变，只需要重新查询一次就ok
			    this.getPetOnlineAuditLogs();
			},
			handleCurrentChange(val) {
				this.query.currentPage = val;
				this.getPetOnlineAuditLogs();
			},
			//获取宠物审核列表
			getPetOnlineAuditLogs() {
				this.listLoading = true; //加载条
				this.$http.post("/petOnlineAuditLog/list",this.query)
                    .then(result => {
                        this.pageData = result.data;
                        this.listLoading = false; //去除加载条
                    })
					.catch(result=>{
					    alert("抱错了！");
					})

			}
		},
		mounted() {
			this.getPetOnlineAuditLogs();
		}
	}

</script>

<style scoped>

</style>